package com.ruoyi.web.controller.drinkwater;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.drinkwater.domain.BusWaterDrinksourceInspections;
import com.ruoyi.drinkwater.service.IBusWaterDrinksourceInspectionsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 饮用水源地巡检记录Controller
 * 
 * @author maliang
 * @date 2025-11-02
 */
@RestController
@RequestMapping("/drinkwater/drinksourceinpections")
public class BusWaterDrinksourceInspectionsController extends BaseController
{
    @Autowired
    private IBusWaterDrinksourceInspectionsService busWaterDrinksourceInspectionsService;

    /**
     * 查询饮用水源地巡检记录列表
     */
    //@PreAuthorize("@ss.hasPermi('drinkwater:drinksourceinpections:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusWaterDrinksourceInspections busWaterDrinksourceInspections)
    {
        startPage("id asc");
        List<BusWaterDrinksourceInspections> list = busWaterDrinksourceInspectionsService.selectBusWaterDrinksourceInspectionsList(busWaterDrinksourceInspections);
        return getDataTable(list);
    }

    /**
     * 导出饮用水源地巡检记录列表
     */
    //@PreAuthorize("@ss.hasPermi('drinkwater:drinksourceinpections:export')")
    @Log(title = "饮用水源地巡检记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusWaterDrinksourceInspections busWaterDrinksourceInspections)
    {
        List<BusWaterDrinksourceInspections> list = busWaterDrinksourceInspectionsService.selectBusWaterDrinksourceInspectionsList(busWaterDrinksourceInspections);
        ExcelUtil<BusWaterDrinksourceInspections> util = new ExcelUtil<BusWaterDrinksourceInspections>(BusWaterDrinksourceInspections.class);
        util.exportExcel(response, list, "饮用水源地巡检记录数据");
    }

    /**
     * 获取饮用水源地巡检记录详细信息
     */
    //@PreAuthorize("@ss.hasPermi('drinkwater:drinksourceinpections:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busWaterDrinksourceInspectionsService.selectBusWaterDrinksourceInspectionsById(id));
    }

    /**
     * 新增饮用水源地巡检记录
     */
    //@PreAuthorize("@ss.hasPermi('drinkwater:drinksourceinpections:add')")
    @Log(title = "饮用水源地巡检记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusWaterDrinksourceInspections busWaterDrinksourceInspections)
    {
        return toAjax(busWaterDrinksourceInspectionsService.insertBusWaterDrinksourceInspections(busWaterDrinksourceInspections));
    }

    /**
     * 修改饮用水源地巡检记录
     */
    //@PreAuthorize("@ss.hasPermi('drinkwater:drinksourceinpections:edit')")
    @Log(title = "饮用水源地巡检记录", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody BusWaterDrinksourceInspections busWaterDrinksourceInspections)
    {
        return toAjax(busWaterDrinksourceInspectionsService.updateBusWaterDrinksourceInspections(busWaterDrinksourceInspections));
    }

    /**
     * 删除饮用水源地巡检记录
     */
    //@PreAuthorize("@ss.hasPermi('drinkwater:drinksourceinpections:remove')")
    @Log(title = "饮用水源地巡检记录", businessType = BusinessType.DELETE)
	@PostMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busWaterDrinksourceInspectionsService.deleteBusWaterDrinksourceInspectionsByIds(ids));
    }
}
